var now = getNowFormatDateTime(); 
var username = sessionStorage.getItem("name");
var userid = sessionStorage.getItem("userId");
var repairid=GetQueryString("repairid");
var flag=GetQueryString("flag");
var photoUrl = [];//拍照列表
var _config ;
var star_attitude = 0;
var star_speed = 0;
var star_cost = 0; 
$(document).ready(function(){
 if(flag=='3'){
	$('#jianyi')[0].style.display="";
 }else if(flag == '4'){
	$('#pingjia')[0].style.display="";
 }
	
	$.ajax({
			url: '../../repair_info/getSelectBody'
			,type:'post'
			,dataType:'json'
			,contentType: "application/json; charset=utf-8"
			,data:JSON.stringify({"repairid":repairid,"baoxiuchaxvn":"baoxiuchaxvn"})  
			,success: function(res){
				console.log(res);
				var resdata = res.data[0];
				$('#repairdate').append(resdata.repairdate);
				$('#shopcode').append(resdata.shopcode);
				$('#shopname').append(resdata.deptname);
				$('#tel').append(resdata.tel);
				$('#repairtype').append(resdata.name);
				$('#instruction').append(resdata.instruction);
			//	console.log(Number(resdata.cost_worker)==""?0:Number(resdata.cost_worker));
				$('#finishdate').append(resdata.finishdate);
				$('#wxys').append(formatCurrencyFixed1(Number(getHourChaBetween(resdata.repairdate,resdata.finishdate))));
				var cost = (Number(resdata.cost_worker)==""?0:Number(resdata.cost_worker)) + (Number(resdata.cost_parts)==""?0:Number(resdata.cost_parts));
				$('#cost').append(cost);
				$('#plan').append(resdata.plan);
				$('#parts').append(resdata.parts);
				$('#lrr').append(resdata.lururen);
			}
	});
	
			layui.use(['rate'], function(){
			  var rate = layui.rate;
			  //显示文字
			  rate.render({
			    elem: '#attitude'
			    ,value: 0 //初始值
			    ,text: true //开启文本
				,choose: function(value){
					 star_attitude=value;
				 }
			  });
	 		  rate.render({
			    elem: '#speed'
			    ,value: 0 //初始值
			    ,text: true //开启文本
				,choose: function(value){
					 star_speed=value;
				 }
			  });
	 			rate.render({
			    elem: '#reasonable'
			    ,value: 0 //初始值
			    ,text: true //开启文本
				,choose: function(value){
					 star_cost=value;
				 }
			  });
			});
});
function objection(){
	$.ajax({
		url: "../../repair_info/advice"
		,type:'post'
		,dataType:'json'
		,async: false
		,contentType: "application/json; charset=utf-8"
		,data:JSON.stringify({"objection":$('#advice').val(),"repairid":repairid,"flag":4}) 
		,success: function(res){
			if(res.status==1002){
			layer.msg("操作成功",{time:1000},function(){
				var url= "../../mobile_page/baoxiu/baoxiu_chaxvn";
				window.location.href = url;
			});
			}
		}					
	});	
}
function advice(){
	$.ajax({
		url: "../../repair_info/advice"
		,type:'post'
		,dataType:'json'
		,async: false
		,contentType: "application/json; charset=utf-8"
		,data:JSON.stringify({"advice":$('#advice').val(),"repairid":repairid,"flag":4}) 
		,success: function(res){
			if(res.status==1002){
				layer.msg("操作成功",{time:1000},function(){
					var url= "../../mobile_page/baoxiu/baoxiu_chaxvn";
					window.location.href = url;
				});
			}
		}					
	});	
}
function evaluation(){
	$.ajax({
		url: "../../repair_info/advice"
		,type:'post'
		,dataType:'json'
		,async: false
		,contentType: "application/json; charset=utf-8"
		,data:JSON.stringify({"repairid":repairid,"flag":5,"star_attitude":star_attitude,"star_speed":star_speed,"star_cost":star_cost}) 
		,success: function(res){
			if(res.status==1002){
				layer.msg("操作成功",{time:1000},function(){
					var url= "../../mobile_page/baoxiu/baoxiu_chaxvn";
					window.location.href = url;
				});
			}
		}					
	});	
}